package com.example.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.dao.CinemaMapper;
import com.example.dao.FilmMapper;
import com.example.entity.Cinema;
import com.example.entity.Film;
import com.example.service.CinemaService;
import com.example.vo.CinemaVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class CinemaServiceImpl implements CinemaService {
    @Autowired
    private CinemaMapper cinemaMapper;
    @Autowired
    private FilmMapper filmMapper;
    @Override
    public List<Cinema> selectAll() {
        QueryWrapper<Cinema> filmQueryWrapper=new QueryWrapper<>();
        List<Cinema> cinemaList=cinemaMapper.selectList(filmQueryWrapper);
        return cinemaList;

    }
//有问题
    @Override
    public List<CinemaVo> selectFilmByCinemaId(String cinemaId) {
        QueryWrapper<Film> filmQueryWrapper=new QueryWrapper<>();
        filmQueryWrapper.like("cinema_id",cinemaId);
        List filmList=filmMapper.selectList(filmQueryWrapper);
        QueryWrapper<Cinema> cinemaQueryWrapper=new QueryWrapper<>();
        cinemaQueryWrapper.like("cinema_id",cinemaId);
        filmList.add(cinemaMapper.selectList(cinemaQueryWrapper));
        return filmList;

    }


}
